#include <signal.h>
#include <iostream>
#include <cstdio>
#include <unistd.h>
void sigcb(int signo)
{
    std::cout << "----------------------------------" << std::endl;
    std::cout << "更改了signal:" << signo << "的默认处理方式" << std::endl;
    std::cout << "HELLO SIGINT!\n" << std::endl;
    std::cout << "----------------------------------" << std::endl;
}

int main()
{
   
    struct sigaction sa;
    sa.sa_handler = sigcb;
    sigaction(SIGINT,&sa,NULL);
    
    for (int i = 1; i < 32; i++)
    {
        printf("%d\n", i);
        sleep(1);
    }
    return 0;
}